<!DOCTYPE HTML>
<html>
    <head>
        <title>Other Page</title>
    </head>
    <body>
        <h1 id="banner">This is the nested document</h1>
        <script>
            window.addEventListener("message", receiveMessage, false);
                 
            function receiveMessage(e) {
                // 本地找不到 回头再试
                if (e.origin == "file:///E:/ForStudy/web-page/JS/Window") {
                    displayMessage(e.data);
                } else {
                    displayMessage("Message Discarded");
                }
            }

            function displayMessage(msg) {
                document.getElementById("banner").innerHTML = msg;
            }
        </script>
    </body>
</html>
